<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal"
    aria-hidden="true" [config]="{ backdrop: 'static' }" (onHidden)="onHidden($event)">
    <div class="modal-dialog modal-xxl">
        <div class="modal-content">
            <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">

                        <span>{{billName}} 调拨单 </span>
                    </h4>

                    <button type="button" class="close" (click)="cancel()" [attr.aria-label]="l('Close')">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">

                        <div class="m-subheader">
                            <div class="row">

                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="f_BillName">单据名称:</label>
                                        <div class="col-7">
                                            <input type="text" class="form-control m-input" name="Search_TaskNum" id="Search_TaskNum"
                                                [required]="true" value="{{f_currentDeptName}}调拨单" disabled />
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="f_OperatorDate">调拨申请日期<span style="color:red">*</span></label>
                                        <div class="col-7">
                                            <p-calendar [(ngModel)]="f_OperatorDate" dateFormat="yy-mm-dd" [locale]="calendarHelper.cn"
                                                id="f_OperatorDate" name="f_OperatorDate" required [disabled]="isEidtItem"></p-calendar>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionOutDept">调出单位<span style="color:red">*</span></label>
                                        <div class="col-7">
                                            <camc-dropdown class="float-left" id="f_ToDeptId" [options]="optionOutDept"
                                                name="f_ToDeptId" [(ngModel)]="selectOutDept" [style]="{ width: '200px' }"
                                                placeholder="请选择" (onChange)="changeInAccounting($event)" required [disabled]="isEidtItem">
                                            </camc-dropdown>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionOutKeeper">调出单位签署<span style="color:red">*</span></label>
                                        <div class="col-7">
                                            <camc-dropdown class="float-left" id="f_OutStoremanId" [options]="optionOutKeeper"
                                                name="f_OutStoremanId" [(ngModel)]="selectOutKeeper" [style]="{ width: '200px' }"
                                                placeholder="请选择" required [disabled]="isEidtItem">
                                            </camc-dropdown>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionInAccounting">计划生产处审批<span style="color:red">*</span></label>
                                        <div class="col-7">
                                            <camc-dropdown placeholder="请选择" class="float-left" id="f_InAccountId"
                                            [options]="optionInAccounting" name="f_InAccountId" [(ngModel)]="selectInAccounting"
                                            [style]="{ width: '200px' }" required [disabled]="isEidtItem">
                                        </camc-dropdown>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionInLeader">工艺技术处审批<span style="color:red">*</span></label>
                                        <div class="col-7">
                                            <camc-dropdown placeholder="请选择" class="float-left" id="f_InLeaderId"
                                            [options]="optionInLeader" name="f_InLeaderId" [(ngModel)]="selectInLeader"
                                            [style]="{ width: '200px' }" required [disabled]="isEidtItem">
                                        </camc-dropdown>
                                           
                                        </div>
                                    </div>
                                </div>
                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="f_PlanNumber">计划号:</label>
                                        <div class="col-7">
                                            <input type="text" class="form-control m-input" name="f_PlanNumber" id="f_PlanNumber"
                                            [(ngModel)]="PlanNumber" />
                                        </div>
                                    </div>
                                </div>

                                <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="f_ContractNumber">合同编号:</label>
                                        <div class="col-7"> 
                                                <input type="text" class="form-control m-input" name="f_ContractNumber" id="f_ContractNumber"
                                            [(ngModel)]="ContractNumber" />
                                        </div>
                                    </div>
                                </div>
                                <!-- <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionOutAccounting">调出单位会计</label>
                                        <div class="col-7">
                                            <camc-dropdown class="float-left" id="f_OutAccountId" [options]="optionOutAccounting"
                                                name="f_OutAccountId" [(ngModel)]="selectOutAccounting"
                                                [style]="{ width: '200px' }" placeholder="请选择">
                                            </camc-dropdown>
                                        </div>
                                    </div>
                                </div> -->
                                <!-- <div class="col-4">
                                    <div class="form-group m-form__group row">
                                        <label class="col-5 col-form-label" for="optionOutLeader">调出单位领导</label>
                                        <div class="col-7">
                                            <camc-dropdown class="float-left" id="f_OutLeaderId" [options]="optionOutLeader"
                                                name="f_OutLeaderId" [(ngModel)]="billbase.f_OutLeaderId" [style]="{ width: '200px' }"
                                                placeholder="请选择">
                                            </camc-dropdown>
                                        </div>
                                    </div>
                                </div> -->
                            </div>
                        </div>
                        <hr />
                        <div class="row align-items-center">
                            <div class="col-md-6">
                                <h4 class="m-subheader__title">调拨单详细信息</h4>
                            </div>
                            <div class="col-md-6 m--align-right">
                                <div class="btn-group m-btn-group" role="group" aria-label="..." *ngIf="!isEidtItem" >
                                    <button type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="accountmodalshow()">
                                        新增
                                    </button>
                                    <button [disabled]="!selectedBill" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="delete()">
                                        删除
                                    </button>
                                </div>
                            </div>
                            <div class="col-md-12 m--margin-top-20">
                                <p-table #detailDataTable [value]="miliOutBillList" [paginator]="false" [lazy]="true"
                                    [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                                    [resizableColumns]="primengTableHelper.resizableColumns" selectionMode="single"
                                    [(selection)]="selectedBill">
                                    <ng-template pTemplate="header">
                                        <tr>

                                            <!-- <th style="width: 40px">
                                                序号
                                            </th> -->
                                            <th width="80px">
                                                工装编号
                                            </th>
                                            <th width="80px">
                                                工装名称
                                            </th>
                                           
                                            <th width="80px">
                                                调出仓库
                                            </th>
                                            <th width="80px">
                                                调出库位
                                            </th>
                                            <th width="90px">
                                                调入仓库<span style="color:red">*</span>
                                            </th>
                                            <th width="90px">
                                                调入库位<span style="color:red">*</span>
                                            </th>
                                            <!-- <th width="80px">
                                                序列号
                                            </th> -->
                                            <th width="80px">
                                                调拨数量<span style="color:red">*</span>
                                            </th>
                                            <th width="80px">
                                                计量单位
                                            </th>
                                            <th width="80px">
                                                单价
                                            </th>
                                            <th width="80px">
                                                金额
                                            </th>
                                            <!-- <th width="80px">
                                                品牌
                                            </th> -->
                                            <th width="80px">
                                                规格
                                            </th>
                                            <th width="80px">
                                                工装图号
                                            </th>
                                            <th width="80px">
                                                产品型号
                                            </th>
                                            <th width="80px">
                                                规格
                                            </th>
                                            <th width="80px">
                                                重量
                                            </th>
                                            <th width="80px">
                                                载荷
                                            </th>
                                            <th width="80px">
                                                长×宽×高
                                            </th>
                                            <th width="80px">
                                                是/否易耗品
                                            </th>
                                            <!-- <th width="80px">
                                                精度
                                            </th> -->
                                            <!-- <th width="80px">
                                                存放地点
                                            </th> -->


                                        </tr>
                                    </ng-template>

                                    <ng-template pTemplate="body" let-record="$implicit" let-i="rowIndex">
                                        <tr [pSelectableRow]="record">

                                            <!-- <td style="width: 40px">
                                                {{ i + 1 }}
                                            </td> -->
                                            <td width="80px">
                                                {{ record.f_MaterialCode }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_MaterialName }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_TargetRoomName }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_TargetLocationCode  }}
                                            </td>
                                            <td width="90px">
                                                <select #itemsCombobox name="'f_WarehouseCode' + i" class="form-control" id="'f_WarehouseCode' + i"
                                                    [(ngModel)]="record.f_WarehouseCode" [attr.data-live-search]="true" (change)='getStorage(i)'>
                                                    <option *ngFor="let room of rooms" [value]="room.value">{{room.label}}</option>
                                                </select>
                                            </td>
                                            <td width="80px">
                                                <select #itemsCombobox  [name]="'f_StorageAreaCode' + i"  class="form-control" id="'f_StorageAreaCode' + i"
                                                [(ngModel)]="record.f_StorageAreaCode" [attr.data-live-search]="true">
                                                <option>请选择</option>
                                                <option *ngFor="let room of f_StorageAreaCodeOption[i]" value="{{room.value}}">{{room.lable}}</option>
                                            </select>
                                            </td>
                                            <!-- <td width="80px">
                                                {{ record.f_InventSerialID }}
                                            </td> -->
                                            <td width="80px">
                                                <input type="number" #input class="form-control m-input" 
                                                    id="f_Quantity"
                                                    [(ngModel)]="record.f_Quantity" [required]="true"  [name]="'f_Quantity_' + i" min="1" />
                                            </td>
                                            <td width="80px">
                                                {{ record.f_Unit }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_Price }}
                                            </td> 
                                            <!-- <td width="80px">
                                                {{ record.f_TradeMark }}
                                            </td> -->
                                            <td width="80px">
                                                {{ record.f_Specification }}
                                            </td>
                                            <!-- <td width="80px">
                                                {{ record.f_Precision }}
                                            </td> -->

                                            <td width="80px">
                                                {{ record.f_CAL_ToolingPictureId }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_ProductModel }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_ProductPictureId }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_ToolingWeight }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_ToolingMaxLoad }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_ProductModelRemark }}
                                            </td>
                                            <td width="80px">
                                                {{ record.f_CAL_IsAttrition }}
                                            </td> 
                                         
                                            <!-- <td width="90px">
                                                <input type="text" class="form-control m-input" name="f_CallInInventBatchID"
                                                    id="f_CallInInventBatchID" [(ngModel)]="record.f_CallInInventBatchID"
                                                    [required]="true" [disabled]="record.f_CallInInventBatchID!=record.f_ReCheckNum&&record.f_Hgz_zydh!=''&&record.f_Hgz_zydh!='undefined'" />
                                            </td> -->

                                        </tr>
                                    </ng-template>
                                </p-table>
                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">
                            <button [disabled]="saving" type="button" class="btn btn-default" (click)="cancel()">
                                    {{ l('Cancel') }}
                                </button>
                        <button type="submit" class="btn btn-primary blue" [disabled]="!editForm.form.valid"
                            [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')">
                            <i class="fa fa-save"></i>
                            <span>{{ l('Save') }}</span>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!-- <simpleAccountBaseInfoModal #simpleAccountBaseInfoModal stocktype='工装' handletype='调拨'  (modalSave)="addAccoutInfo($event)"></simpleAccountBaseInfoModal> -->